import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { getAllRolesListNoByTenant, getAllTenantList } from './user.api';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
const renderContent = (filed) => {
  return (record, rowIndex) => {
    const obj: any = {
      children: record[filed],
      attrs: {},
    };
    if (rowIndex === 9) {
      obj.attrs.colSpan = 0;
    }
    return obj;
  };
};
export const columns: BasicColumn[] = [
  {
    title: '流程名称',
    dataIndex: 'subject',
    width: 120,
  },
  {
    title: '申请人',
    dataIndex: 'initiator',
    width: 120,
    customRender: ({ text }) => {
      console.log(text, 29);

      return text == '1' ? '国内订单' : text == '2' ? '国际订单' : '';
    },
  },
  {
    title: '当前节点',
    dataIndex: 'node_name ',
    width: 120,
    sorter: true,
    customCell: renderContent('node_name ')
  },
  {
    title: '申请时间',
    dataIndex: 'create_time',
    width: 120,

  }
];


export const searchFormSchema: FormSchema[] = [
  //  {
  //   label: '角色',
  //   field: 'selectedroles',
  //   component: 'ApiSelect',
  //   componentProps: {
  //     mode: 'multiple',
  //     api: getAllRolesListNoByTenant,
  //     labelField: 'roleName',
  //     valueField: 'id',
  //     immediate: false,
  //   },
  // },
  {
    label: '',
    field: 'selectedroles',
    component: 'Select',
    defaultValue: true,
    componentProps: {
      options: [
        {
          label: '显示委托代办',
          value: true,
          key: '1',
        },
        {
          label: '过滤委托代办',
          value: false,
          key: '2',
        },
      ],
    },
    colProps: {
      span: 4,
    },
  },
  // {
  //   field: 'field33',
  //   component: 'ApiTreeSelect',
  //   label: '',
  //   required: true,
  //   componentProps: {
  //     api: '',
  //     resultField: 'list',
  //   },
  //   colProps: {
  //     span: 4,
  //   },
  // },
  {
    field: 'subject',
    component: 'Input',
    label: '',
    componentProps: {
      placeholder: '流程名称，任务主题',
      onChange: (e: any) => {
        console.log(e);
      },
    },
    colProps: {
      span: 4,
    },
  },
];


